#ifndef GENIE_V_JOYSTICK
#define GENIE_V_JOYSTICK

struct platform
{
   UINT8 fHigh: 1;
   UINT8 fLiftDrive: 1;    // 0 is a drive default 1 is  a lift
   UINT8 fHorn: 1;
   UINT8 fEnable: 1;
   UINT8 fRight: 1;
   UINT8 fLeft: 1;
   UINT8 fNeutral: 1;
   UINT8 fDirection: 1;
   UINT8 fLift: 1;
   UINT8 fDrive: 1;
   UINT8 fEnable1: 1;


   INT8 nJoystickCounts;
   INT8 nRockerCounts;
};

struct joystick
{
   enum
   {
      JOYSTICK_OFFSET = 0
      , JOYSTICK_FAILURE
      , JOYSTICK_NEUTRAL_FAILURE
      , JOYSTICK_ADJUST
      , JOYSTICK_FINISH_INIT
   } eState;

   INT16 bCount;
   INT16 nCenter;
   UINT8 fPlatformReady: 1;
   UINT8 fNeutralFault: 1;
   UINT8 fEnableSwitchFault: 1;
   UINT8 fLeftSwitchFault: 1;
   UINT8 fRightSwitchFault: 1;

   INT8  nJoystickCounts;
};

struct rocker
{
   enum
   {
      ROCKER_OFFSET = 0
      , ROCKER_FAILURE
      , ROCKER_NEUTRAL_FAILURE
      , ROCKER_ADJUST
      , iROCKER_FINISH_INIT
   } eState;

   INT16 bCount;
   INT16 nCenter;
   UINT8 fPlatformReady: 1;
   UINT8 fNeutralFault: 1;
   UINT8 fEnableSwitchFault: 1;
   UINT8 fLeftSwitchFault: 1;
   UINT8 fRightSwitchFault: 1;

   INT8  nRockerCounts;
};

#define SW_HIGH            PLATFORM_Data.fHigh
#define LIFT_DRIVE         PLATFORM_Data.fLiftDrive
#define SW_HORN            PLATFORM_Data.fHorn
#define JS_NEUTRAL         PLATFORM_Data.fNeutral
#define SW_ENABLE          PLATFORM_Data.fEnable
#define SW_ENABLE_RAW      PLATFORM_Data.fEnable1
#define SW_RIGHT           PLATFORM_Data.fRight
#define SW_LEFT            PLATFORM_Data.fLeft
#define JS_DIRECTION       PLATFORM_Data.fDirection
#define SW_LIFT            PLATFORM_Data.fLift
#define SW_DRIVE           PLATFORM_Data.fDrive

#define Y_AXIS_COUNTS      PLATFORM_Data.nJoystickCounts
#define X_AXIS_COUNTS      PLATFORM_Data.nRockerCounts

#define JOYSTICK_RAW_COUNTS  PLATFORM_Data.nJoystickCounts
#define ROCKER_RAW_COUNTS   PLATFORM_Data.nRockerCounts

#define JOYSTICK_INIT         JOYSTICK_Data.fPlatformReady
#define JOYSTICK_NEUTRAL_FAULT  JOYSTICK_Data.fNeutralFault

//extern struct rocker   ROCKER_Data;
extern struct joystick JOYSTICK_Data;
extern struct platform PLATFORM_Data;

extern void JoystickAdjust(void);
extern void JoystickInit(void);

extern void RockerAdjust(void);
extern void RockerInit(void);


#endif // GENIE_V_JOYSTICK
